package com.sjgtw.cloud.client.oauth.builder.api;

import com.sjgtw.cloud.client.http.HttpVerb;

public class FouraOAuthApi extends OAuthApi20 {
    // approval_prompt:force or auto
    public static  String DEFAULT_WEB_URL = "";

    private static final String AUTHORIZATION_ENDPOINT = "/authz/oauth/v20/authorize?client_id=%s&response_type=code&redirect_uri=%s&scope=openid";

    //private static final String TOKEN_ENDPOINT    = "/token?grant_type=authorization_code";
    private static final String TOKEN_ENDPOINT    = "/authz/oauth/v20/token";
    
    //private static final String AUTHORIZATION_ENDPOINT = "/authz/oauth/v20/authorize?client_id=%s&response_type=code&redirect_uri=%s&approval_prompt=auto";

    //private static final String TOKEN_ENDPOINT    = "/authz/oauth/v20/token?grant_type=authorization_code";
    
    
    public FouraOAuthApi() {
		super();
		this.authorizeUrl = DEFAULT_WEB_URL + AUTHORIZATION_ENDPOINT;
	}

	public FouraOAuthApi(String baseURL) {
    	DEFAULT_WEB_URL = baseURL;
        this.authorizeUrl = DEFAULT_WEB_URL + AUTHORIZATION_ENDPOINT;
    }

    @Override
    public String getAccessTokenEndpoint() {
        return DEFAULT_WEB_URL + TOKEN_ENDPOINT;
    }

    @Override
    public HttpVerb getAccessTokenVerb() {
        return HttpVerb.POST;
    }
    

    @Override
    public String getGrantType() {
        return "authorization_code";
    }
}
